<template>
	<view class="message">
		<textarea @input="input" placeholder="请粘贴或输入您要发布的招工信息" />
		<view @click="publish" class="release">发布招工</view>
		<view @click="voiceXunFei" class="voice">
			<image src="../../static/麦克风.png" mode=""></image>
			语音识别
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				input:undefined,
			}
		},
		
		methods:{
			publish(){
				debugger
				if(!this.input){
					Dialog.alert({
					  title: '标题',
					  message: '弹窗内容',
					}).then(() => {
					  // on close
					});
				}
			},
			voiceXunFei() {
							let vm = this;
							let options = {};
							//#ifdef APP-PLUS || APP-PLUS-NVUE
							options.engine = 'iFly';
							options.punctuation = false; // 是否需要标点符号 
							options.timeout = 10 * 1000;
							plus.speech.startRecognize(options, function(s) {
								vm.searchText = vm.searchText + s;
								console.log(vm.searchText) //拿到语音识别的结果
								//下面是逻辑  
								vm.searchValue = s;
							
								vm.searchText = ""
								plus.speech.stopRecognize();
							});
							//#endif
							// #ifdef H5
							    alert("只有h5平台才有alert方法")
							// #endif 
						}
		}
		
	}
</script>

<style lang="scss" scoped>
	.message{
		height: 100vh;
		padding: 20rpx 30rpx;
		display: flex;
		justify-content: center;
		position: relative;
		textarea{
			border: solid 1px #a6a6a6;
			border-radius: 15rpx;
			padding: 10rpx 20rpx;
		}
		.release{
			position: absolute;
			bottom: 120rpx;
			background: #007AFF;
			color: #FFFFFF;
			font-size: 44rpx;
			padding: 10rpx 100rpx;
			border-radius: 10rpx;
		}
		.voice{
			border: solid 1px #8a8a8a;
			color: #8a8a8a;
			position: absolute;
			top: 270rpx;
			right: 80rpx;
			border-radius: 999rpx;
			padding: 0 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			image{
				width: 50rpx;
				height: 50rpx;
			}
		}
	}
</style>
